package com.bingxue.edu.management.report.controller;

import com.bingxue.edu.framework.common.model.Response;
import com.bingxue.edu.framework.security.ApiResource;
import com.bingxue.edu.management.report.model.query.FinAccountStatQuery;
import com.bingxue.edu.management.report.model.resp.FinAccountStatResp;
import com.bingxue.edu.management.shop.service.FinAccountService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author panbo
 * @since 2024/11/26
 */
@Slf4j
@Tag(name = "数据统计接口")
@RestController
@RequestMapping("/report/fin")
@RequiredArgsConstructor
public class FinReportController {

    private final FinAccountService finAccountService;

    @Operation(summary = "财务收支统计" , description = "财务收支统计")
    @ApiResource("report:fin:stat")
    @GetMapping("/stat")
    public Response<List<FinAccountStatResp>> getFinAccountStat(@Validated FinAccountStatQuery query) {
        List<FinAccountStatResp> stats = finAccountService.getFinAccountStat(query);
        return Response.success(stats);
    }

}
